package com.lefevre.cms.bean.help;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 帮助
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("help")
@Entity
@Table(name = "help", indexes = {@Index(name = "help_idx", columnList = "helpTypeId,visible")})
public class Help implements Serializable {
    private static final long serialVersionUID = 2548461575859641680L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(type = IdType.INPUT)
    private Long id;

    /**
     * 用户名称
     **/
    @Column(length = 30)
    @TableField("userName")
    private String userName;

    /**
     * 帮助分类Id
     **/
    @TableField("helpTypeId")
    private Long helpTypeId;

    /**
     * 帮助分类名称
     **/
    @Transient
    @TableField(exist = false)
    private String helpTypeName;

    /**
     * 帮助名称
     **/
    @Column(length = 200)
    @TableField("`name`")
    private String name;

    /**
     * 帮助内容
     **/
    @Lob
    @TableField("`content`")
    private String content;

    /**
     * 发表时间
     **/
    @Temporal(TemporalType.TIMESTAMP)
    @TableField("times")
    private Date times = new Date();

    /**
     * 是否可见
     **/
    @TableField("visible")
    private boolean visible = true;

    public Help(Long id, String name) {
        this.id = id;
        this.name = name;
    }
}
